------------------------------------------------------------------------------------------------------------------------------------
       log:  \\asfs.asnet.ua-net.ua.edu\users$\home\joneal\My Documents\gartzke\dor_18162001_060712.log
  log type:  text
 opened on:  27 Sep 2012, 11:12:07
Analysis do-file dor_18162001_060712 run on 27 Sep 2012 at 11:12:07

. /*create data with conflict marked for originators only and for originators plus joiners, all MIDs and fatal MIDs;
> combined originators_032612.do and alldyads_032612.do: 06-07-12; reviewed 9-25-2012*/
. 
. 
. /*create data for replication of Gartzke & Weisiger, mark originators and joiners, working in mydocs\gartzke: 3-26-12*/
. 
. 
. set mem 400m
(409600k)

. 
. 
. /*infile data for all dyads*/
. 
. * STATA command file generated by EUGene  3.20 to read data file
. * "C:\Program Files\EUGene\gartzkebig.raw"
. * To execute this command file: 
. *    1) Run STATA,
. *    2) "cd" to directory "C:\Program Files\EUGene\",
. *    3) enter command "do gartzkebig.raw.do".
. 
. * Number of observations in this data set: 803889
. 
. * Data set specifications:
. *   Base Format: Non-directed Dyad
. *   Time Span: 1816 to 2008
. *   Selected Subset: All dyads included)
. *   Sampling: None (100% of available data written to file)
. *   Variables included:
. *        ccode1 ccode2  year    ISOShNm ISOShNm cap_1   cap_2   majpow1 majpow2 alliance        dem1    dem2    contig  distance  
>       numstate        mzongo  mzongonm        mzmid   mzmidnm mzhost1 mzhost2 mzkeynum        mzfatald        mzcowwar
. *   Selected settings for variables with multiple output options:
. *        Alliances taken from COW dyadic alliance file
. *        Distance variable measured using capitol coordinates and land contiguity, including modifications from The War Trap
. *        Peace years calculated without Werner peace year adjustment
. *        Conflict exclusions based on Maoz MID data
. *       Dispute characteristics:
. *        When two or more disputes occur in a year, data is from the highest intensity dispute
. *        Disputes marked for originators and joiners
. *        Dyad-years with an ongoing MID included iff there is a new MID
. *        Ongoing dispute years not considered new initiations
. *        Joiner Dyads included
. 
. * Note:  EUGene draws on datasets originally published elsewhere by other scholars.  When 
. * presenting analysis using data generated by EUGene, please cite the original data sources 
. * as well as EUGene (see EUGene documentation, Appendix D) 
. *
. * Bibliography for this data set:
. * Gibler, Douglas M., and Meredith Sarkees. 2002. "Coding Manual for v3.0 of the Correlates of War Formal Interstate Alliance Data
>  set, 1816-2000." Typescript. 
. * Jaggers, Keith, and Ted Robert Gurr.  1995.  "Tracking Democracy's Third Wave with the Polity III Data."  Journal of Peace Resea
> rch 32:469-482.
. * Maoz, Zeev.  1999.  "Dyadic Militarized Interstate Disputes, version 1.1."  Available at ftp://spirit.tau.ac.il/zeevmaoz/dyadmid
> .doc
. * Reiter, Dan.  2000.  "Interstate Alliances, 1985-1992: version 2."  Unpublished memorandum.
. * Singer, J. David, Stuart Bremer, and John Stuckey.  1972.  "Capability Distribution, Uncertainty, and Major Power War, 1820-1965
> ."  in Bruce Russett, ed.     Peace, War and Numbers.  Beverly Hills:  Sage.
. * Small, Melvin, and J. David Singer.  1969.  "Formal Alliances, 1815-1965:  An Extension of the Basic Data."  Journal of Peace Re
> search 6: 257-282.  
. * Small, Melvin, and J. David Singer.  1982.  Resort to Arms:  International and Civil Wars, 1816-1980.  Beverly Hills:  Sage Publ
> ications.
. * Werner, Suzanne.  2000.  "The Effects of Political Similarity on the Onset of Militarized Disputes, 1816-1985."  Political Resea
> rch Quarterly 53(2): 343-374.
. 
. #delimit ;
delimiter now ;
. clear;

. *set memory 84901k;
. infile int ccode1 int ccode2 int year str40 ISOShNm1 str40 ISOShNm2 float cap_1 float cap_2 byte majpow1 byte majpow2 byte allianc
> e byte dem1 byte dem2 byte contig float distance int numstate int mzongo int mzongonm int mzmid int mzmidnm int mzhost1 int mzhost
> 2 int mzkeynum int mzfatald byte mzcowwar  using "C:\Program Files\EUGene\gartzkebig.raw";
'ccode1' cannot be read as a number for ccode1[1]
'ccode2' cannot be read as a number for ccode2[1]
'year' cannot be read as a number for year[1]
'cap_1' cannot be read as a number for cap_1[1]
'cap_2' cannot be read as a number for cap_2[1]
'majpow1' cannot be read as a number for majpow1[1]
'majpow2' cannot be read as a number for majpow2[1]
'alliance' cannot be read as a number for alliance[1]
'dem1' cannot be read as a number for dem1[1]
'dem2' cannot be read as a number for dem2[1]
'contig' cannot be read as a number for contig[1]
'distance' cannot be read as a number for distance[1]
'numstate' cannot be read as a number for numstate[1]
'mzongo' cannot be read as a number for mzongo[1]
'mzongonm' cannot be read as a number for mzongonm[1]
'mzmid' cannot be read as a number for mzmid[1]
'mzmidnm' cannot be read as a number for mzmidnm[1]
'mzhost1' cannot be read as a number for mzhost1[1]
'mzhost2' cannot be read as a number for mzhost2[1]
'mzkeynum' cannot be read as a number for mzkeynum[1]
'mzfatald' cannot be read as a number for mzfatald[1]
'mzcowwar' cannot be read as a number for mzcowwar[1]
(803890 observations read)

. * The next command drops the case that was read 
> *  if the user included a line of variable names;
. drop if missing(ccode1) | missing(year);
(1 observation deleted)

. * Interpret missing values;
.  mvdecode ccode1 ccode2 year ISOShNm1 ISOShNm2 cap_1 cap_2 majpow1 majpow2 alliance contig distance numstate mzongo mzongonm mzmid
>  mzmidnm mzhost1 mzhost2 mzkeynum mzfatald mzcowwar , mv(-9);
    ISOShNm1: string variable ignored
    ISOShNm2: string variable ignored
       cap_1: 18721 missing values generated
       cap_2: 18721 missing values generated
    alliance: 147248 missing values generated
      contig: 110785 missing values generated
      mzongo: 129121 missing values generated
    mzongonm: 129121 missing values generated
       mzmid: 129121 missing values generated
     mzmidnm: 129121 missing values generated
     mzhost1: 129121 missing values generated
     mzhost2: 129121 missing values generated
    mzkeynum: 129121 missing values generated
    mzfatald: 129511 missing values generated
    mzcowwar: 129121 missing values generated

. mvdecode dem1 dem2 , mv(-99);
        dem1: 299859 missing values generated
        dem2: 292381 missing values generated

. mvdecode dem1 dem2 , mv(-88);
        dem1: 10440 missing values generated
        dem2: 11480 missing values generated

. mvdecode dem1 dem2 , mv(-77);
        dem1: 3808 missing values generated
        dem2: 7009 missing values generated

. mvdecode dem1 dem2 , mv(-66);
        dem1: 1469 missing values generated
        dem2: 1594 missing values generated

. * Variable labels where available (see EUGeneDocumentation.doc for full information);
.  label variable dem1 "Democracy Score for cc1 (democ-autoc)";

. label variable dem2 "Democracy Score for cc2 (democ-autoc)";

. label variable ccode1 "COW CCode Num for state 1";

. label variable ccode2 "COW CCode Num for state 2";

. label variable year "Year of observation";

. label variable cap_1 "National Capabilities Index (CINC) for cc1";

. label variable cap_2 "National Capabilities Index (CINC) for cc2";

. label variable majpow1 "Major power status of cc1";

. label variable majpow2 "Major power status of cc2";

. label variable alliance "Alliance type (1=defense pact, 2=neutrality, 3=entente, 4=no agreement)";

. label variable contig "Direct contig (1=Lnd, 2=1-12 miles watr, 3=13-24, 4=25-150, 5=151-400, 6=not)";

. label variable distance "Distance, from cc1 to cc2, in miles";

. label variable numstate "Number of states in intl system as defined by COW system membership";

. label variable mzongo "A MID was ongoing at beginning of year, Maoz dyadic data plus MID 3.0";

. label variable mzongonm "Num of the MID that was ongoing at the beginning of the year, if any";

. label variable mzmid "MID Onset: MID occurred betw cc1 and cc2 in year (0=no, 1=yes) (maoz data).";

. label variable mzmidnm "Num of the new MID that began in this year, if any (0 if no MID was ongoing)";

. label variable mzhost1 "Relevant hostility level reached by cc1 in a MID vs. cc2 in this year ";

. label variable mzhost2 "Relevant hostility level reached by cc2 in a MID vs. cc1 in this year";

. label variable mzkeynum "Key MID number: Num of MID for which other MID variables are reported.  ";

. label variable mzfatald "Overall dispute fatality level (maoz data)";

. label variable mzcowwar "COW war dyad, Maoz data. Reflects actual warring dyads in multilateral disputes.";

. compress;
distance was float now int
mzongo was int now byte
mzmid was int now byte
mzhost1 was int now byte
mzhost2 was int now byte
mzfatald was int now byte
ISOShNm1 was str40 now str30
ISOShNm2 was str40 now str30

. #del cr
delimiter now cr
. 
. desc

Contains data
  obs:       803,889                          
 vars:            24                          
 size:    80,388,900 (80.8% of memory free)
-------------------------------------------------------------------------------
              storage  display     value
variable name   type   format      label      variable label
-------------------------------------------------------------------------------
ccode1          int    %8.0g                  COW CCode Num for state 1
ccode2          int    %8.0g                  COW CCode Num for state 2
year            int    %8.0g                  Year of observation
ISOShNm1        str30  %30s                   
ISOShNm2        str30  %30s                   
cap_1           float  %9.0g                  National Capabilities Index
                                                (CINC) for cc1
cap_2           float  %9.0g                  National Capabilities Index
                                                (CINC) for cc2
majpow1         byte   %8.0g                  Major power status of cc1
majpow2         byte   %8.0g                  Major power status of cc2
alliance        byte   %8.0g                  Alliance type (1=defense pact,
                                                2=neutrality, 3=entente, 4=no
                                                agreement)
dem1            byte   %8.0g                  Democracy Score for cc1
                                                (democ-autoc)
dem2            byte   %8.0g                  Democracy Score for cc2
                                                (democ-autoc)
contig          byte   %8.0g                  Direct contig (1=Lnd, 2=1-12
                                                miles watr, 3=13-24, 4=25-150,
                                                5=151-400, 6=not)
distance        int    %9.0g                  Distance, from cc1 to cc2, in
                                                miles
numstate        int    %8.0g                  Number of states in intl system
                                                as defined by COW system
                                                membership
mzongo          byte   %8.0g                  A MID was ongoing at beginning
                                                of year, Maoz dyadic data plus
                                                MID 3.0
mzongonm        int    %8.0g                  Num of the MID that was ongoing
                                                at the beginning of the year,
                                                if any
mzmid           byte   %8.0g                  MID Onset: MID occurred betw
                                                cc1 and cc2 in year (0=no,
                                                1=yes) (maoz data).
mzmidnm         int    %8.0g                  Num of the new MID that began
                                                in this year, if any (0 if no
                                                MID was ongoing)
mzhost1         byte   %8.0g                  Relevant hostility level
                                                reached by cc1 in a MID vs. cc2
                                                in this year 
mzhost2         byte   %8.0g                  Relevant hostility level
                                                reached by cc2 in a MID vs. cc1
                                                in this year
mzkeynum        int    %8.0g                  Key MID number: Num of MID for
                                                which other MID variables are
                                                reported.  
mzfatald        byte   %8.0g                  Overall dispute fatality level
                                                (maoz data)
mzcowwar        byte   %8.0g                  COW war dyad, Maoz data.
                                                Reflects actual warring dyads
                                                in multilateral disputes.
-------------------------------------------------------------------------------
Sorted by:  
     Note:  dataset has changed since last saved

. summ

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      ccode1 |    803889    288.2633    203.5916          2        987
      ccode2 |    803889    574.6977    222.5663         20        990
        year |    803889    1973.147    36.73236       1816       2008
    ISOShNm1 |         0
    ISOShNm2 |         0
-------------+--------------------------------------------------------
       cap_1 |    785168    .0094868    .0318999          0    .383864
       cap_2 |    785168    .0084585    .0240828          0    .336619
     majpow1 |    803889    .0595754    .2366986          0          1
     majpow2 |    803889    .0440409    .2051862          0          1
    alliance |    656641    3.816518     .704634          1          4
-------------+--------------------------------------------------------
        dem1 |    488313    .2368542    7.553652        -10         10
        dem2 |    491425   -1.754296    7.391316        -10         10
      contig |    693104    5.826775    .8623289          1          6
    distance |    803889    4689.894    2813.337          0      12347
    numstate |    803889    145.6564    50.02123         23        194
-------------+--------------------------------------------------------
      mzongo |    674768    .0003409    .0184592          0          1
    mzongonm |    674768    .7176644    46.84278          0       4324
       mzmid |    674768    .0045171    .0670575          0          1
     mzmidnm |    674768    10.00677    175.7956          0       4344
     mzhost1 |    674768    .0144124    .2304752          0          5
-------------+--------------------------------------------------------
     mzhost2 |    674768    .0137618    .2250992          0          5
    mzkeynum |    674768    9.961446    175.2908          0       4343
    mzfatald |    674378     .004628    .1535421          0          6
    mzcowwar |    674768    .0004624    .0214981          0          1

. 
. drop mzhost* mzongo* mzmidnm mzkey

. 
. ren ccode1 statea

. ren ccode2 stateb

. ren cap_1 cap_a

. ren cap_2 cap_b

. ren dem1 dem_a

. ren dem2 dem_b

. 
. /*255-265-1990 and 260-265-1990, etc both in EUGene data*/
. drop if statea==260 & year==1990
(118 observations deleted)

. drop if stateb==260 & year==1990
(45 observations deleted)

. summ stateb if statea==255 & year==1990

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      stateb |       117    586.7094    173.0568        290        990

. summ statea if stateb==255 & year==1990

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      statea |        45    114.5333    67.29501          2        235

. 
. /*odd cases in Eugene*/
. drop if statea==679 & year==1990
(36 observations deleted)

. drop if stateb==679 & year==1990
(125 observations deleted)

. summ stateb if statea==678 & year==1990

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      stateb |        37    792.5405    85.36803        680        990

. summ statea if stateb==678 & year==1990

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      statea |       125     349.104    201.1215          2        670

. 
. /*recode to be consistent with BR's determination*/
. replace statea=260 if statea==255 & year<1946
(2458 real changes made)

. replace stateb=260 if stateb==255 & year<1946
(2700 real changes made)

. replace statea=260 if statea==255 & year>1989
(2650 real changes made)

. replace stateb=260 if stateb==255 & year>1989
(887 real changes made)

. 
. replace statea=315 if statea==316 & year>1992
(2209 real changes made)

. replace stateb=315 if stateb==316 & year>1992
(816 real changes made)

. 
. replace statea=678 if statea==679 & year>1990
(835 real changes made)

. replace stateb=678 if stateb==679 & year>1990
(2543 real changes made)

. 
. /*identify fatal MIDs and create onset variables for year + 1: all dyads*/
. gen mzfatal=1 if mzmid==1 & mzfatald>0 & mzfatald~=.
(802758 missing values generated)

. replace mzfatal=0 if mzfatald==0
(673247 real changes made)

. 
. sort statea stateb year

. 
. by statea stateb: gen mzmid1_all=mzmid[_n+1] if year[_n+1]==year+1
(150586 missing values generated)

. 
. by statea stateb: gen mzfatal1_all=mzfatal[_n+1] if year[_n+1]==year+1
(150933 missing values generated)

. 
. by statea stateb: gen mzcowwar1_all=mzcowwar[_n+1] if year[_n+1]==year+1
(150586 missing values generated)

. drop mzmid mzfatal mzcowwar mzfatald

. 
. compress
mzmid1_all was float now byte
mzfatal1_all was float now byte
mzcowwar1_all was float now byte

. keep if year<2001
(147248 observations deleted)

. sort statea stateb year

. 
. lab data "Dafoe, Oneal, Russett data for 1816-2001, working in mydocs\gartzke"

. lab var mzmid1_all "=mzmid[_n+1] if year[_n+1]==year+1: originators & joiners"

. lab var mzfatal1_all "=mzfatal[_n+1], where mzfatal=1 if mzmid==1 & mzfatald>0 & mzfatald~=.: origin & joiners"
note: label truncated to 80 characters

. lab var mzcowwar1_all "=mzcowwar[_n+1] & year[_n+1]==year+1: originators and joiners"

. 
. summ

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      statea |    656317    281.8588    201.3662          2        987
      stateb |    656317     564.255    221.8199         20        990
        year |    656317      1966.1    37.15992       1816       2000
    ISOShNm1 |         0
    ISOShNm2 |         0
-------------+--------------------------------------------------------
       cap_a |    656317    .0103495    .0339315          0    .383864
       cap_b |    656317    .0090587    .0250059          0    .336619
     majpow1 |    656317    .0627715    .2425517          0          1
     majpow2 |    656317    .0478016    .2133464          0          1
    alliance |    656317    3.816573    .7045293          1          4
-------------+--------------------------------------------------------
       dem_a |    488175    .2361305     7.55352        -10         10
       dem_b |    491298   -1.754424    7.391296        -10         10
      contig |    656317    5.822887    .8717867          1          6
    distance |    656317    4641.624    2811.585          0      12347
    numstate |    656317    135.1635    49.64297         23        191
-------------+--------------------------------------------------------
  mzmid1_all |    652979    .0042773    .0652613          0          1
mzfatal1_all |    652632    .0010986    .0331274          0          1
mzcowwar1_~l |    652979    .0004242     .020592          0          1

. 
. save temp19a, replace
file temp19a.dta saved

. 
. 
. 
. 
. use "\\\asfs.asnet.ua-net.ua.edu\users$\home\joneal\My Documents\gartzke\polity4v2010.dta"   /*compatible w/ BR's codings; created
>  by polity4v2010.do*/
(Polity IVv2010 w/ changes from Eugene codebook, 62ff & BR, 1816-2000: in mydocs\)

. desc

Contains data from \\asfs.asnet.ua-net.ua.edu\users$\home\joneal\My Documents\gartzke\polity4v2010.dta
  obs:        13,985                          Polity IVv2010 w/ changes from
                                                Eugene codebook, 62ff & BR,
                                                1816-2000: in mydocs\
 vars:             7                          25 Sep 2012 15:10
 size:       531,430 (99.9% of memory free)
-------------------------------------------------------------------------------
              storage  display     value
variable name   type   format      label      variable label
-------------------------------------------------------------------------------
ccode           int    %8.0g                  
scode           str3   %9s                    
country         str24  %24s                   
year            int    %8.0g                  
democ           byte   %8.0g                  Polity 4v2010 democ score
autoc           byte   %8.0g                  Polity 4v2010 autoc score
polity2         byte   %8.0g                  revised combined score,
                                                minimizes missing, Polity4v2010
-------------------------------------------------------------------------------
Sorted by:  ccode  year

. summ 

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
       ccode |     13985    393.2177    251.3029          2        950
       scode |         0
     country |         0
        year |     13985    1930.274    53.78968       1816       2000
       democ |     13358    3.170085    3.786169          0         10
-------------+--------------------------------------------------------
       autoc |     13358    4.436143    3.461605          0         10
     polity2 |     13824   -1.258464    6.897349        -10         10

. keep ccode year polity2 democ autoc

. sort ccode year

. save temp44, replace
file temp44.dta saved

. 
. 
. use "\\\asfs.asnet.ua-net.ua.edu\users$\home\joneal\My Documents\gartzke\temp19a.dta", clear
(Dafoe, Oneal, Russett data for 1816-2001, working in mydocs\gartzke)

. 
. ren statea ccode

. sort ccode year

. merge ccode year using temp44
variables ccode year do not uniquely identify observations in the master data

. tab _m

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |     67,959       10.32       10.32
          2 |      2,247        0.34       10.66
          3 |    588,358       89.34      100.00
------------+-----------------------------------
      Total |    658,564      100.00

. drop if _m==2
(2247 observations deleted)

. drop _m 

. ren polity2 polity2a

. /*use Polity III data in Eugene to supplement Polity IV*/
. replace polity2a=dem_a if polity2a==.
(10778 real changes made)

. ren democ democa

. ren autoc autoca

. ren ccode statea

. 
. ren stateb ccode

. sort ccode year

. merge ccode year using temp44
variables ccode year do not uniquely identify observations in the master data

. tab _m

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |     47,605        7.23        7.23
          2 |      2,284        0.35        7.57
          3 |    608,712       92.43      100.00
------------+-----------------------------------
      Total |    658,601      100.00

. drop if _m==2
(2284 observations deleted)

. drop _m 

. ren polity2 polity2b

. /*use Polity III data in Eugene to supplement Polity IV*/
. replace polity2b=dem_b if polity2b==.
(11176 real changes made)

. ren democ democb

. ren autoc autocb

. ren ccode stateb

. 
. sort statea stateb year

. 
. summ state* year polity2* democ* autoc* 

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      statea |    656317    281.8588    201.3662          2        987
      stateb |    656317     564.255    221.8199         20        990
        year |    656317      1966.1    37.15992       1816       2000
    polity2a |    595813     .700161    7.391536        -10         10
    polity2b |    612506   -1.430089    7.174522        -10         10
-------------+--------------------------------------------------------
      democa |    566576    4.131825     4.18423          0         10
      democb |    577428    3.073879    3.875629          0         10
      autoca |    566576     3.51529     3.47352          0         10
      autocb |    577428    4.598838    3.599043          0         10

. 
. save alldyads_tmp, replace
file alldyads_tmp.dta saved

. 
. 
. 
. /*infile data for originators only and merge with all dyads data*/
. 
. *STATA command file generated by EUGene  3.20 to read data file
. * "C:\Program Files\EUGene\gartzke.raw"
. * To execute this command file: 
. *    1) Run STATA,
. *    2) "cd" to directory "C:\Program Files\EUGene\",
. *    3) enter command "do gartzke.raw.do".
. 
. * Number of observations in this data set: 803112
. 
. * Data set specifications:
. *   Base Format: Non-directed Dyad
. *   Time Span: 1816 to 2008
. *   Selected Subset: All dyads included)
. *   Sampling: None (100% of available data written to file)
. *   Variables included:
. *        ccode1 ccode2  year    ISOShNm ISOShNm cap_1   cap_2   majpow1 majpow2 alliance        dem1    dem2    contig  distance  
>       numstate        mzongo  mzongonm        mzmid   mzmidnm mzhost1 mzhost2 mzkeynum        mzfatald        mzcowwar
. *   Selected settings for variables with multiple output options:
. *        Alliances taken from COW dyadic alliance file
. *        Distance variable measured using capitol coordinates and land contiguity, including modifications from The War Trap
. *        Peace years calculated without Werner peace year adjustment
. *        Conflict exclusions based on Maoz MID data
. *       Dispute characteristics:
. *        When two or more disputes occur in a year, data is from the highest intensity dispute
. *        Disputes marked for originators only
. *        Dyad-years with an ongoing MID included iff there is a new MID
. *        Ongoing dispute years not considered new initiations
. *        Joiner Dyads dropped
. 
. * Note:  EUGene draws on datasets originally published elsewhere by other scholars.  When 
. * presenting analysis using data generated by EUGene, please cite the original data sources 
. * as well as EUGene (see EUGene documentation, Appendix D) 
. *
. * Bibliography for this data set:
. * Gibler, Douglas M., and Meredith Sarkees. 2002. "Coding Manual for v3.0 of the Correlates of War Formal Interstate Alliance Data
>  set, 1816-2000." Typescript. 
. * Jaggers, Keith, and Ted Robert Gurr.  1995.  "Tracking Democracy's Third Wave with the Polity III Data."  Journal of Peace Resea
> rch 32:469-482.
. * Maoz, Zeev.  1999.  "Dyadic Militarized Interstate Disputes, version 1.1."  Available at ftp://spirit.tau.ac.il/zeevmaoz/dyadmid
> .doc
. * Reiter, Dan.  2000.  "Interstate Alliances, 1985-1992: version 2."  Unpublished memorandum.
. * Singer, J. David, Stuart Bremer, and John Stuckey.  1972.  "Capability Distribution, Uncertainty, and Major Power War, 1820-1965
> ."  in Bruce Russett, ed.     Peace, War and Numbers.  Beverly Hills:  Sage.
. * Small, Melvin, and J. David Singer.  1969.  "Formal Alliances, 1815-1965:  An Extension of the Basic Data."  Journal of Peace Re
> search 6: 257-282.  
. * Small, Melvin, and J. David Singer.  1982.  Resort to Arms:  International and Civil Wars, 1816-1980.  Beverly Hills:  Sage Publ
> ications.
. * Werner, Suzanne.  2000.  "The Effects of Political Similarity on the Onset of Militarized Disputes, 1816-1985."  Political Resea
> rch Quarterly 53(2): 343-374.
. 
. #delimit ;
delimiter now ;
. clear;

. *set memory 84821k;
. infile int ccode1 int ccode2 int year str40 ISOShNm1 str40 ISOShNm2 float cap_1 float cap_2 byte majpow1 byte majpow2 byte allianc
> e byte dem1 byte dem2 byte contig float distance int numstate int mzongo int mzongonm int mzmid int mzmidnm int mzhost1 int mzhost
> 2 int mzkeynum int mzfatald byte mzcowwar  using "C:\Program Files\EUGene\gartzke.raw";
'ccode1' cannot be read as a number for ccode1[1]
'ccode2' cannot be read as a number for ccode2[1]
'year' cannot be read as a number for year[1]
'cap_1' cannot be read as a number for cap_1[1]
'cap_2' cannot be read as a number for cap_2[1]
'majpow1' cannot be read as a number for majpow1[1]
'majpow2' cannot be read as a number for majpow2[1]
'alliance' cannot be read as a number for alliance[1]
'dem1' cannot be read as a number for dem1[1]
'dem2' cannot be read as a number for dem2[1]
'contig' cannot be read as a number for contig[1]
'distance' cannot be read as a number for distance[1]
'numstate' cannot be read as a number for numstate[1]
'mzongo' cannot be read as a number for mzongo[1]
'mzongonm' cannot be read as a number for mzongonm[1]
'mzmid' cannot be read as a number for mzmid[1]
'mzmidnm' cannot be read as a number for mzmidnm[1]
'mzhost1' cannot be read as a number for mzhost1[1]
'mzhost2' cannot be read as a number for mzhost2[1]
'mzkeynum' cannot be read as a number for mzkeynum[1]
'mzfatald' cannot be read as a number for mzfatald[1]
'mzcowwar' cannot be read as a number for mzcowwar[1]
(803113 observations read)

. * The next command drops the case that was read 
> *  if the user included a line of variable names;
. drop if missing(ccode1) | missing(year);
(1 observation deleted)

. * Interpret missing values;
.  mvdecode ccode1 ccode2 year ISOShNm1 ISOShNm2 cap_1 cap_2 majpow1 majpow2 alliance contig distance numstate mzongo mzongonm mzmid
>  mzmidnm mzhost1 mzhost2 mzkeynum mzfatald mzcowwar , mv(-9);
    ISOShNm1: string variable ignored
    ISOShNm2: string variable ignored
       cap_1: 18721 missing values generated
       cap_2: 18721 missing values generated
    alliance: 147235 missing values generated
      contig: 110785 missing values generated
      mzongo: 129121 missing values generated
    mzongonm: 129121 missing values generated
       mzmid: 129121 missing values generated
     mzmidnm: 129121 missing values generated
     mzhost1: 129121 missing values generated
     mzhost2: 129121 missing values generated
    mzkeynum: 129121 missing values generated
    mzfatald: 129381 missing values generated
    mzcowwar: 129121 missing values generated

. mvdecode dem1 dem2 , mv(-99);
        dem1: 299763 missing values generated
        dem2: 292276 missing values generated

. mvdecode dem1 dem2 , mv(-88);
        dem1: 10419 missing values generated
        dem2: 11469 missing values generated

. mvdecode dem1 dem2 , mv(-77);
        dem1: 3803 missing values generated
        dem2: 6999 missing values generated

. mvdecode dem1 dem2 , mv(-66);
        dem1: 1459 missing values generated
        dem2: 1580 missing values generated

. * Variable labels where available (see EUGeneDocumentation.doc for full information);
.  label variable dem1 "Democracy Score for cc1 (democ-autoc)";

. label variable dem2 "Democracy Score for cc2 (democ-autoc)";

. label variable ccode1 "COW CCode Num for state 1";

. label variable ccode2 "COW CCode Num for state 2";

. label variable year "Year of observation";

. label variable cap_1 "National Capabilities Index (CINC) for cc1";

. label variable cap_2 "National Capabilities Index (CINC) for cc2";

. label variable majpow1 "Major power status of cc1";

. label variable majpow2 "Major power status of cc2";

. label variable alliance "Alliance type (1=defense pact, 2=neutrality, 3=entente, 4=no agreement)";

. label variable contig "Direct contig (1=Lnd, 2=1-12 miles watr, 3=13-24, 4=25-150, 5=151-400, 6=not)";

. label variable distance "Distance, from cc1 to cc2, in miles";

. label variable numstate "Number of states in intl system as defined by COW system membership";

. label variable mzongo "A MID was ongoing at beginning of year, Maoz dyadic data plus MID 3.0";

. label variable mzongonm "Num of the MID that was ongoing at the beginning of the year, if any";

. label variable mzmid "MID Onset: MID occurred betw cc1 and cc2 in year (0=no, 1=yes) (maoz data).";

. label variable mzmidnm "Num of the new MID that began in this year, if any (0 if no MID was ongoing)";

. label variable mzhost1 "Relevant hostility level reached by cc1 in a MID vs. cc2 in this year ";

. label variable mzhost2 "Relevant hostility level reached by cc2 in a MID vs. cc1 in this year";

. label variable mzkeynum "Key MID number: Num of MID for which other MID variables are reported.  ";

. label variable mzfatald "Overall dispute fatality level (maoz data)";

. label variable mzcowwar "COW war dyad, Maoz data. Reflects actual warring dyads in multilateral disputes.";

. compress;
distance was float now int
mzongo was int now byte
mzmid was int now byte
mzhost1 was int now byte
mzhost2 was int now byte
mzfatald was int now byte
ISOShNm1 was str40 now str30
ISOShNm2 was str40 now str30

. #del cr
delimiter now cr
. 
. desc

Contains data
  obs:       803,112                          
 vars:            24                          
 size:    80,311,200 (80.9% of memory free)
-------------------------------------------------------------------------------
              storage  display     value
variable name   type   format      label      variable label
-------------------------------------------------------------------------------
ccode1          int    %8.0g                  COW CCode Num for state 1
ccode2          int    %8.0g                  COW CCode Num for state 2
year            int    %8.0g                  Year of observation
ISOShNm1        str30  %30s                   
ISOShNm2        str30  %30s                   
cap_1           float  %9.0g                  National Capabilities Index
                                                (CINC) for cc1
cap_2           float  %9.0g                  National Capabilities Index
                                                (CINC) for cc2
majpow1         byte   %8.0g                  Major power status of cc1
majpow2         byte   %8.0g                  Major power status of cc2
alliance        byte   %8.0g                  Alliance type (1=defense pact,
                                                2=neutrality, 3=entente, 4=no
                                                agreement)
dem1            byte   %8.0g                  Democracy Score for cc1
                                                (democ-autoc)
dem2            byte   %8.0g                  Democracy Score for cc2
                                                (democ-autoc)
contig          byte   %8.0g                  Direct contig (1=Lnd, 2=1-12
                                                miles watr, 3=13-24, 4=25-150,
                                                5=151-400, 6=not)
distance        int    %9.0g                  Distance, from cc1 to cc2, in
                                                miles
numstate        int    %8.0g                  Number of states in intl system
                                                as defined by COW system
                                                membership
mzongo          byte   %8.0g                  A MID was ongoing at beginning
                                                of year, Maoz dyadic data plus
                                                MID 3.0
mzongonm        int    %8.0g                  Num of the MID that was ongoing
                                                at the beginning of the year,
                                                if any
mzmid           byte   %8.0g                  MID Onset: MID occurred betw
                                                cc1 and cc2 in year (0=no,
                                                1=yes) (maoz data).
mzmidnm         int    %8.0g                  Num of the new MID that began
                                                in this year, if any (0 if no
                                                MID was ongoing)
mzhost1         byte   %8.0g                  Relevant hostility level
                                                reached by cc1 in a MID vs. cc2
                                                in this year 
mzhost2         byte   %8.0g                  Relevant hostility level
                                                reached by cc2 in a MID vs. cc1
                                                in this year
mzkeynum        int    %8.0g                  Key MID number: Num of MID for
                                                which other MID variables are
                                                reported.  
mzfatald        byte   %8.0g                  Overall dispute fatality level
                                                (maoz data)
mzcowwar        byte   %8.0g                  COW war dyad, Maoz data.
                                                Reflects actual warring dyads
                                                in multilateral disputes.
-------------------------------------------------------------------------------
Sorted by:  
     Note:  dataset has changed since last saved

. summ

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      ccode1 |    803112    288.2491    203.5713          2        987
      ccode2 |    803112    574.7625    222.5636         20        990
        year |    803112    1973.173    36.71837       1816       2008
    ISOShNm1 |         0
    ISOShNm2 |         0
-------------+--------------------------------------------------------
       cap_1 |    784391    .0094358    .0317732          0    .383864
       cap_2 |    784391     .008433    .0240193          0    .336619
     majpow1 |    803112    .0591997    .2359983          0          1
     majpow2 |    803112    .0438469    .2047546          0          1
    alliance |    655877    3.816804    .7041295          1          4
-------------+--------------------------------------------------------
        dem1 |    487668    .2370547    7.553003        -10         10
        dem2 |    490788   -1.751707    7.392315        -10         10
      contig |    692327    5.828305    .8585085          1          6
    distance |    803112    4692.246    2812.649          0      12347
    numstate |    803112     145.699    49.99836         23        194
-------------+--------------------------------------------------------
      mzongo |    673991    .0002122    .0145645          0          1
    mzongonm |    673991    .4563592    36.48933          0       4324
       mzmid |    673991    .0033695    .0579494          0          1
     mzmidnm |    673991    8.022315     157.109          0       4343
     mzhost1 |    673991    .0102464    .1910987          0          5
-------------+--------------------------------------------------------
     mzhost2 |    673991    .0097702    .1858616          0          5
    mzkeynum |    673991    7.991635    156.7209          0       4343
    mzfatald |    673731    .0017678    .0882823          0          6
    mzcowwar |    673991    .0001395    .0118088          0          1

. 
. drop mzhost* mzongo* mzmidnm mzkey

. compress

. 
. ren ccode1 statea

. ren ccode2 stateb

. ren cap_1 cap_a

. ren cap_2 cap_b

. ren dem1 dem_a

. ren dem2 dem_b

. 
. /*255-265-1990 and 260-265-1990, etc both in EUGene data*/
. drop if statea==260 & year==1990
(118 observations deleted)

. drop if stateb==260 & year==1990
(45 observations deleted)

. summ stateb if statea==255 & year==1990

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      stateb |       117    586.7094    173.0568        290        990

. summ statea if stateb==255 & year==1990

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      statea |        45    114.5333    67.29501          2        235

. 
. /*odd cases in Eugene*/
. drop if statea==679 & year==1990
(36 observations deleted)

. drop if stateb==679 & year==1990
(125 observations deleted)

. summ stateb if statea==678 & year==1990

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      stateb |        37    792.5405    85.36803        680        990

. summ statea if stateb==678 & year==1990

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      statea |       125     349.104    201.1215          2        670

. 
. /*recode to be consistent with BR's determination*/
. replace statea=260 if statea==255 & year<1946
(2421 real changes made)

. replace stateb=260 if stateb==255 & year<1946
(2656 real changes made)

. replace statea=260 if statea==255 & year>1989
(2646 real changes made)

. replace stateb=260 if stateb==255 & year>1989
(887 real changes made)

. 
. replace statea=315 if statea==316 & year>1992
(2208 real changes made)

. replace stateb=315 if stateb==316 & year>1992
(816 real changes made)

. 
. replace statea=678 if statea==679 & year>1990
(835 real changes made)

. replace stateb=678 if stateb==679 & year>1990
(2543 real changes made)

. 
. /*identify fatal MIDs and create onset variables for year + 1: originators only*/
. gen mzfatal=1 if mzmid==1 & mzfatald>0 & mzfatald~=.
(802375 missing values generated)

. replace mzfatal=0 if mzfatald==0
(672994 real changes made)

. 
. sort statea stateb year

. 
. by statea stateb: gen mzmid1_orig=mzmid[_n+1] if year[_n+1]==year+1
(150882 missing values generated)

. 
. by statea stateb: gen mzfatal1_orig=mzfatal[_n+1] if year[_n+1]==year+1
(151104 missing values generated)

. 
. by statea stateb: gen mzcowwar1_orig=mzcowwar[_n+1] if year[_n+1]==year+1
(150882 missing values generated)

. drop mzmid mzfatal mzcowwar mzfatald

. 
. compress
mzmid1_orig was float now byte
mzfatal1_orig was float now byte
mzcowwar1_orig was float now byte

. keep if year<2001
(147235 observations deleted)

. sort statea stateb year

. 
. lab var mzmid1_orig "=mzmid[_n+1] if year[_n+1]==year+1: originators only"

. lab var mzfatal1_orig"=mzfatal[_n+1] if year[_n+1]==year+1: originators only"

. lab var mzcowwar1_orig"=mzcowwar[_n+1] & year[_n+1]==year+1: originators only"

. 
. desc

Contains data
  obs:       655,553                          
 vars:            18                          
 size:    59,655,323 (85.8% of memory free)
-------------------------------------------------------------------------------
              storage  display     value
variable name   type   format      label      variable label
-------------------------------------------------------------------------------
statea          int    %8.0g                  COW CCode Num for state 1
stateb          int    %8.0g                  COW CCode Num for state 2
year            int    %8.0g                  Year of observation
ISOShNm1        str30  %30s                   
ISOShNm2        str30  %30s                   
cap_a           float  %9.0g                  National Capabilities Index
                                                (CINC) for cc1
cap_b           float  %9.0g                  National Capabilities Index
                                                (CINC) for cc2
majpow1         byte   %8.0g                  Major power status of cc1
majpow2         byte   %8.0g                  Major power status of cc2
alliance        byte   %8.0g                  Alliance type (1=defense pact,
                                                2=neutrality, 3=entente, 4=no
                                                agreement)
dem_a           byte   %8.0g                  Democracy Score for cc1
                                                (democ-autoc)
dem_b           byte   %8.0g                  Democracy Score for cc2
                                                (democ-autoc)
contig          byte   %8.0g                  Direct contig (1=Lnd, 2=1-12
                                                miles watr, 3=13-24, 4=25-150,
                                                5=151-400, 6=not)
distance        int    %9.0g                  Distance, from cc1 to cc2, in
                                                miles
numstate        int    %8.0g                  Number of states in intl system
                                                as defined by COW system
                                                membership
mzmid1_orig     byte   %9.0g                  =mzmid[_n+1] if
                                                year[_n+1]==year+1: originators
                                                only
mzfatal1_orig   byte   %9.0g                  =mzfatal[_n+1] if
                                                year[_n+1]==year+1: originators
                                                only
mzcowwar1_orig  byte   %9.0g                  =mzcowwar[_n+1] &
                                                year[_n+1]==year+1: originators
                                                only
-------------------------------------------------------------------------------
Sorted by:  statea  stateb  year
     Note:  dataset has changed since last saved

. summ

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      statea |    655553    281.8357    201.3396          2        987
      stateb |    655553    564.3248    221.8187         20        990
        year |    655553    1966.124     37.1485       1816       2000
    ISOShNm1 |         0
    ISOShNm2 |         0
-------------+--------------------------------------------------------
       cap_a |    655553    .0102896    .0337929          0    .383864
       cap_b |    655553     .009029     .024935          0    .336619
     majpow1 |    655553    .0623169    .2417303          0          1
     majpow2 |    655553     .047569    .2128527          0          1
    alliance |    655553     3.81686    .7040244          1          4
-------------+--------------------------------------------------------
       dem_a |    487530    .2363301     7.55287        -10         10
       dem_b |    490661   -1.751835    7.392295        -10         10
      contig |    655553    5.824472    .8678873          1          6
    distance |    655553    4644.412    2810.789          0      12347
    numstate |    655553    135.2044    49.62414         23        191
-------------+--------------------------------------------------------
 mzmid1_orig |    651906    .0030909    .0555102          0          1
mzfatal1_o~g |    651684    .0005233    .0228689          0          1
mzcowwar1_~g |    651906    .0001104    .0105087          0          1

. 
. keep statea stateb year mzmid1 mzfatal1 mzcowwar1

. 
. save originators_tmp, replace
file originators_tmp.dta saved

. 
. 
. /*merge originators and joiners data with originators only data*/
. 
. use alldyads_tmp
(Dafoe, Oneal, Russett data for 1816-2001, working in mydocs\gartzke)

. 
. merge statea stateb year using originators_tmp

. tab _m

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        764        0.12        0.12
          3 |    655,553       99.88      100.00
------------+-----------------------------------
      Total |    656,317      100.00

. drop _m

. 
. drop dem_a dem_b

. label var democa "Polity 4v2010 democ score"

. label var democb "Polity 4v2010 democ score"

. label var autoca "Polity 4v2010 autoc score"

. label var autocb "Polity 4v2010 autoc score"

. 
. desc

Contains data from alldyads_tmp.dta
  obs:       656,317                          Dafoe, Oneal, Russett data for
                                                1816-2001, working in
                                                mydocs\gartzke
 vars:            25                          27 Sep 2012 11:13
 size:    64,319,066 (84.7% of memory free)
-------------------------------------------------------------------------------
              storage  display     value
variable name   type   format      label      variable label
-------------------------------------------------------------------------------
statea          int    %8.0g                  COW CCode Num for state 1
stateb          int    %8.0g                  COW CCode Num for state 2
year            int    %8.0g                  Year of observation
ISOShNm1        str30  %30s                   
ISOShNm2        str30  %30s                   
cap_a           float  %9.0g                  National Capabilities Index
                                                (CINC) for cc1
cap_b           float  %9.0g                  National Capabilities Index
                                                (CINC) for cc2
majpow1         byte   %8.0g                  Major power status of cc1
majpow2         byte   %8.0g                  Major power status of cc2
alliance        byte   %8.0g                  Alliance type (1=defense pact,
                                                2=neutrality, 3=entente, 4=no
                                                agreement)
contig          byte   %8.0g                  Direct contig (1=Lnd, 2=1-12
                                                miles watr, 3=13-24, 4=25-150,
                                                5=151-400, 6=not)
distance        int    %9.0g                  Distance, from cc1 to cc2, in
                                                miles
numstate        int    %8.0g                  Number of states in intl system
                                                as defined by COW system
                                                membership
mzmid1_all      byte   %9.0g                  =mzmid[_n+1] if
                                                year[_n+1]==year+1: originators
                                                & joiners
mzfatal1_all    byte   %9.0g                  =mzfatal[_n+1], where mzfatal=1
                                                if mzmid==1 & mzfatald>0 &
                                                mzfatald~=.: origin &
mzcowwar1_all   byte   %9.0g                  =mzcowwar[_n+1] &
                                                year[_n+1]==year+1: originators
                                                and joiners
democa          byte   %8.0g                  Polity 4v2010 democ score
autoca          byte   %8.0g                  Polity 4v2010 autoc score
polity2a        byte   %8.0g                  revised combined score,
                                                minimizes missing, Polity4v2010
democb          byte   %8.0g                  Polity 4v2010 democ score
autocb          byte   %8.0g                  Polity 4v2010 autoc score
polity2b        byte   %8.0g                  revised combined score,
                                                minimizes missing, Polity4v2010
mzmid1_orig     byte   %9.0g                  =mzmid[_n+1] if
                                                year[_n+1]==year+1: originators
                                                only
mzfatal1_orig   byte   %9.0g                  =mzfatal[_n+1] if
                                                year[_n+1]==year+1: originators
                                                only
mzcowwar1_orig  byte   %9.0g                  =mzcowwar[_n+1] &
                                                year[_n+1]==year+1: originators
                                                only
-------------------------------------------------------------------------------
Sorted by:  
     Note:  dataset has changed since last saved

. summ

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      statea |    656317    281.8588    201.3662          2        987
      stateb |    656317     564.255    221.8199         20        990
        year |    656317      1966.1    37.15992       1816       2000
    ISOShNm1 |         0
    ISOShNm2 |         0
-------------+--------------------------------------------------------
       cap_a |    656317    .0103495    .0339315          0    .383864
       cap_b |    656317    .0090587    .0250059          0    .336619
     majpow1 |    656317    .0627715    .2425517          0          1
     majpow2 |    656317    .0478016    .2133464          0          1
    alliance |    656317    3.816573    .7045293          1          4
-------------+--------------------------------------------------------
      contig |    656317    5.822887    .8717867          1          6
    distance |    656317    4641.624    2811.585          0      12347
    numstate |    656317    135.1635    49.64297         23        191
  mzmid1_all |    652979    .0042773    .0652613          0          1
mzfatal1_all |    652632    .0010986    .0331274          0          1
-------------+--------------------------------------------------------
mzcowwar1_~l |    652979    .0004242     .020592          0          1
      democa |    566576    4.131825     4.18423          0         10
      autoca |    566576     3.51529     3.47352          0         10
    polity2a |    595813     .700161    7.391536        -10         10
      democb |    577428    3.073879    3.875629          0         10
-------------+--------------------------------------------------------
      autocb |    577428    4.598838    3.599043          0         10
    polity2b |    612506   -1.430089    7.174522        -10         10
 mzmid1_orig |    651906    .0030909    .0555102          0          1
mzfatal1_o~g |    651684    .0005233    .0228689          0          1
mzcowwar1_~g |    651906    .0001104    .0105087          0          1

. 
. compress

. sort statea stateb year

. 
. save dor_18162001_060712, replace
file dor_18162001_060712.dta saved

. 
. 
. exit

end of do-file
       log:  \\asfs.asnet.ua-net.ua.edu\users$\home\joneal\My Documents\gartzke\dor_18162001_060712.log
  log type:  text
 closed on:  27 Sep 2012, 11:15:10
------------------------------------------------------------------------------------------------------------------------------------
